import Taro from '@tarojs/taro-rn';
import * as tslib_1 from "tslib";
import React from 'react';
import { Component } from "@tarojs/taro-rn";
import { View, Image, Text } from "@tarojs/components-rn";
import { toJS } from 'mobx';
import { inject, observer } from "@tarojs/mobx-rn";
import PageFooterInfo from "../../components/PageFooterInfo";
import ViewPhone from "../../components/ViewPhone";
import Report from "../../components/Report";
import { getRuntime, getAvatar, subtime } from "../../utils/common";
import service_detailStyleSheet from "./service_detail_styles";
var _styleSheet = service_detailStyleSheet;

let Personnel = class Personnel extends Component {
  constructor(props) {
    super(props);
    this.state = {
      isVip: false,
      info: {}
    };
  }
  componentDidShow() {
    Taro.setNavigationBarTitle({ title: '服务详情' });
    let id = this.$router.params.id;
    if (!id) {
      getRuntime().navigateBack();
    }
    this.getInfomationInfos(parseInt(id));
    let userInfo = getRuntime().getUserInfo();
    //console.log(userInfo)
    if (userInfo && userInfo.agencyLevel > 0) {
      this.setState({ isVip: true });
    }
  }
  handelRouter(url = '/pages/index/index') {
    getRuntime().navigateTo(url);
  }
  getInfomationInfos(formId) {
    let { homeStore } = this.props.stores;
    homeStore.getInfomationInfos({
      formId,
      callback: home => {
        //console.log(home)
        this.setState({
          info: toJS(home)
        });
      }
    });
  }
  render() {
    let { info, isVip } = this.state;
    return <View style={[_styleSheet["newest-index"], _styleSheet["demand_detail"]]}>
        <View style={_styleSheet["list-13-item"]}>
          <View style={_styleSheet["line"]}>
            <View style={_styleSheet["l"]}>
              <Image src={getAvatar(info.userLogoImg)} style={_styleSheet["pic"]} />
              <View>
                <View style={_styleSheet["name"]}>{info.userNickName}</View>
                <View style={_styleSheet["list-info"]}>{subtime(info.creationTime)}</View>
              </View>
            </View>
            <View style={_styleSheet["r"]}>{info.numberOfVisits}次浏览</View>
          </View>
          <View style={_styleSheet["personnel-desc"]}>
            {info.description}
          </View>
        </View>

        <View style={[_styleSheet["column-title"], _styleSheet["content-30"]]}>
          <Text style={_styleSheet["column-name"]}>联系方式</Text>
        </View>
        <View style={_styleSheet["item-lawyer"]}>
          <View style={_styleSheet["line"]}>
            <Text style={_styleSheet["title"]}>联系人：</Text>
            {isVip && <Text style={_styleSheet["name"]}>{info.contacts}</Text>}
            {!isVip && <View style={_styleSheet["name"]}>
               <Text>*******</Text>
               <Text style={_styleSheet["vip"]}>(VIP会员可见)</Text>
            </View>}
            {!isVip && <ViewPhone />}
          </View>
          <View style={_styleSheet["line"]}>
            <Text style={_styleSheet["title"]}>联系电话：</Text>
            {isVip && <Text style={_styleSheet["name"]}>{info.phone}</Text>}
            {!isVip && <View style={_styleSheet["name"]}>
               <Text>*******</Text>
               <Text style={_styleSheet["vip"]}>(VIP会员可见)</Text>
            </View>}
          </View>
          <View style={_styleSheet["line"]}>
            <Text style={_styleSheet["title"]}>微信号：</Text>
            {isVip && <Text style={_styleSheet["name"]}>{info.wechatNo}</Text>}
            {!isVip && <View style={_styleSheet["name"]}>
               <Text>*******</Text>
               <Text style={_styleSheet["vip"]}>(VIP会员可见)</Text>
            </View>}
          </View>
          <View style={_styleSheet["line"]}>
            <Text style={_styleSheet["title"]}>QQ号：</Text>
            {isVip && <Text style={_styleSheet["name"]}>{info.qqNo}</Text>}
            {!isVip && <View style={_styleSheet["name"]}>
               <Text>*******</Text>
               <Text style={_styleSheet["vip"]}>(VIP会员可见)</Text>
            </View>}
          </View>
        </View>
        <View style={_styleSheet["interval"]} />
        <Report />
        <PageFooterInfo />

      </View>;
  }
};
Personnel = tslib_1.__decorate([inject("stores"), observer], Personnel);
export default Personnel;